cmake_minimum_required(VERSION 3.5)
project(Zigbee3.0-BaseDevice C)

set(CMAKE_C_STANDARD 11)


add_definitions(-DFACTORY_NEW)

add_definitions(-DUART_BAUD_RATE=1000000)
add_definitions(-DCOORDINATOR)
add_definitions(-DCRC_XOR)
add_definitions(-DAPP_AHI_CONTROL)
add_definitions(-DJN516x=5160)
add_definitions(-DJN5169=5169)
add_definitions(-DJENNIC_CHIP_NAME=_JN5169)
add_definitions(-DJENNIC_CHIP_FAMILY_NAME=_JN516x)
add_definitions(-DWATCHDOG_ENABLED)
add_definitions(-DJENNIC_HW_BBC_RXINCCA=1)
add_definitions(-DJENNIC_HW_BBC_DMA=1)
add_definitions(-DJENNIC_HW_BBC_ISA=0)
add_definitions(-DJENNIC_SW_EXTERNAL_FLASH=0)
add_definitions(-DJN516X_DMA_UART_BACKWARDS_COMPATIBLE_API=1)
add_definitions(-DUART_BACKWARDS_COMPATIBLE_API=1)
add_definitions(-DRXPOWERADJUST_SUPPORT)
add_definitions(-DJENNIC_CHIP=JN5169)
add_definitions(-DJENNIC_CHIP_JN5169)
add_definitions(-DJENNIC_CHIP_FAMILY=JN516x)
add_definitions(-DJENNIC_CHIP_FAMILY_JN516x)
add_definitions(-DJENNIC_STACK_ZCL)
add_definitions(-DJENNIC_MAC_MiniMacShim)
add_definitions(-DEMBEDDED)
add_definitions(-DJENNIC_PCB=DEVKIT4)
add_definitions(-DJENNIC_PCB_DEVKIT4)
add_definitions(-DPDM_USER_SUPPLIED_ID)
add_definitions(-DPDM_NO_RTOS)
add_definitions(-DPDM_EEPROM)
add_definitions(-DDBG_ENABLE)
add_definitions(-DZPS_APL_OPT_SINGLE_INSTANCE)
add_definitions(-DOTA_NO_CERTIFICATE)
add_definitions(-DPLME_SAP)
add_definitions(-DZBPRO_DEVICE_TYPE_ZCR)
add_definitions(-DBDB_SUPPORT_NWK_STEERING)
add_definitions(-DBDB_SUPPORT_NWK_FORMATION)
add_definitions(-DBDB_SUPPORT_OOBC)
add_definitions(-DDONGLE)
add_definitions(-DDEBUG_APP)
add_definitions(-DDEBUG_BDB)
add_definitions(-DDEBUG_ZCL)
add_definitions(-DDEBUG_APP_BDB)
add_definitions(-DDEBUG_APP_EVENT)
add_definitions(-DDEBUG_APP_NCI)
add_definitions(-DDEBUG_APP_ICODE)
add_definitions(-DUSB_DONGLE)
add_definitions(-DCLD_ONOFF)
add_definitions(-DONOFF_SERVER)

include_directories(../../sdk/JN-SW-4170/Platform/Common/Include)
include_directories(../../sdk/JN-SW-4170/Platform/DK4/Include)
include_directories(../../sdk/JN-SW-4170/Platform/DK4/Build)
include_directories(../../sdk/JN-SW-4170/Components/Common/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZigbeeCommon/Include)
include_directories(../../sdk/JN-SW-4170/Components/Random/Include)
include_directories(../../sdk/JN-SW-4170/Components/Aes/Include)
include_directories(../../sdk/JN-SW-4170/Components/HardwareAPI/Include)
include_directories(../../sdk/JN-SW-4170/Components/BDB/Source/OutOfBand)
include_directories(../../sdk/JN-SW-4170/Components/AppApi/Include)
include_directories(../../sdk/JN-SW-4170/Components/MAC/Include)
include_directories(../../sdk/JN-SW-4170/Components/MiniMac/Include)
include_directories(../../sdk/JN-SW-4170/Components/MMAC/Include)
include_directories(../../sdk/JN-SW-4170/Components/HardwareAPI/Include)
include_directories(../../sdk/JN-SW-4170/Components/Aes/Include)
include_directories(../../sdk/JN-SW-4170/Components/DBG/Include)
include_directories(../../sdk/JN-SW-4170/Components/Mac/Include)
include_directories(../../sdk/JN-SW-4170/Components/MicroSpecific/Include)
include_directories(../../sdk/JN-SW-4170/Components/MiniMAC/Include)
include_directories(../../sdk/JN-SW-4170/Components/MMAC/Include)
include_directories(../../sdk/JN-SW-4170/Components/TimerServer/Include)
include_directories(../../sdk/JN-SW-4170/Components/Random/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZigbeeCommon/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZPSMAC_Mini_SOC/Include)
include_directories(../../sdk/JN-SW-4170/Components/PWRM/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZPSTSV/Include)
include_directories(../../sdk/JN-SW-4170/Components/AES_SW/Include)
include_directories(../../sdk/JN-SW-4170/Components/PDUM/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZPSAPL/Include)
include_directories(../../sdk/JN-SW-4170/Components/Random/Include)
include_directories(../../sdk/JN-SW-4170/Components/PDM_EEPROM_NO_RTOS/Include)
include_directories(../../sdk/JN-SW-4170/Components/DBG/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZPSNWK/Include)
include_directories(../../sdk/JN-SW-4170/Components/PDM/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZPSMAC/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZPSNWK/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZigbeeCommon/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCIF/Source)
include_directories(../../sdk/JN-SW-4170/Components/ZCIF/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/General/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/General/Source)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/General/Source)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/MeasurementAndSensing/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/Lighting/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/HVAC/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/Closures/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/SecurityAndSafety/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/SmartEnergy/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/OTA/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/Commissioning/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/ApplianceManagement/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Clusters/GreenPower/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZHA/Generic/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZHA/Generic/Source)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZLO/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZHA/HVAC/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZHA/Closures/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZHA/SecurityAndSafety/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZHA/SmartEnergy/Include)
include_directories(../../sdk/JN-SW-4170/Components/ZCL/Devices/ZHA/ApplianceManagement/Include)
include_directories(../../sdk/JN-SW-4170/Components/BDB/Include)
include_directories(../../sdk/JN-SW-4170/Components/BDB/Source/Common)
include_directories(../../sdk/JN-SW-4170/Components/BDB/Source/NwkSteering)
include_directories(../../sdk/JN-SW-4170/Components/BDB/Source/NwkFormation)
include_directories(../../sdk/JN-SW-4170/Components/BDB/Source/OutOfBand)
include_directories(../../sdk/Tools/ba-elf-ba2-r36379/include)

include_directories(NFC/Include)
include_directories(NTAG/Include)
include_directories(NCI/Include)
include_directories(Common/Source)
include_directories(Coordinator/Source)
include_directories(Router/Source)
include_directories(EndDevice/Source)

add_definitions(-DBUTTON_MAP_DR1199)

set(SRC_COMMON
        Common/Source/app.zpscfg
        Common/Source/app_buttons.c
        Common/Source/app_buttons.h
        Common/Source/app_common.h
        Common/Source/app_events.h
        Common/Source/app_icode.c
        Common/Source/app_icode.h
        Common/Source/app_nci_aes.c
        Common/Source/app_nci_aes.h
        Common/Source/app_nci_icode.c
        Common/Source/app_nci_icode.h
        Common/Source/app_ntag_aes.c
        Common/Source/app_ntag_aes.h
        Common/Source/app_ntag_icode.c
        Common/Source/app_ntag_icode.h
        Common/Source/app_pdm.c
        Common/Source/app_pdm.h
        Common/Source/PDM_IDs.h)

set(SRC_END_DEVICE
        EndDevice/Source/app_end_device_node.c
        EndDevice/Source/app_end_device_node.h
        EndDevice/Source/app_main.c
        EndDevice/Source/app_main.h
        EndDevice/Source/app_start.c
        EndDevice/Source/app_zcl_task.c
        EndDevice/Source/app_zcl_task.h
        EndDevice/Source/bdb_options.h
        EndDevice/Source/irq_JN516x.S
        EndDevice/Source/pdum_apdu.S
        EndDevice/Source/zcl_options.h
        EndDevice/Source/pdum_gen.c
        EndDevice/Source/pdum_gen.h
        EndDevice/Source/zps_gen.c
        EndDevice/Source/zps_gen.h)

set(SRC_ROUTER
        Router/Source/app_led_interface.c
        Router/Source/app_led_interface.h
        Router/Source/app_main.c
        Router/Source/app_main.h
        Router/Source/app_reporting.c
        Router/Source/app_reporting.h
        Router/Source/app_router_node.c
        Router/Source/app_router_node.h
        Router/Source/app_start.c
        Router/Source/app_zcl_task.c
        Router/Source/app_zcl_task.h
        Router/Source/bdb_options.h
        Router/Source/irq_JN516x.S
        Router/Source/pdum_apdu.S
        Router/Source/zcl_options.h
        Router/Source/pdum_gen.c
        Router/Source/pdum_gen.h
        Router/Source/zps_gen.c
        Router/Source/zps_gen.h
        )

set(SRC_COORDINATOR
        Coordinator/Source/app_coordinator.c
        Coordinator/Source/app_coordinator.h
        Coordinator/Source/app_main.c
        Coordinator/Source/app_main.h
        Coordinator/Source/app_serial_commands.c
        Coordinator/Source/app_serial_commands.h
        Coordinator/Source/app_start.c
        Coordinator/Source/app_zcl_task.c
        Coordinator/Source/app_zcl_task.h
        Coordinator/Source/bdb_options.h
        Coordinator/Source/irq_JN516x.S
        Coordinator/Source/pdum_apdu.S
        Coordinator/Source/uart.c
        Coordinator/Source/uart.h
        Coordinator/Source/zcl_options.h
        Coordinator/Source/pdum_gen.c
        Coordinator/Source/pdum_gen.h
        Coordinator/Source/zps_gen.c
        Coordinator/Source/zps_gen.h
        )

add_executable(coordinator ${SRC_COORDINATOR} ${SRC_COMMON})
add_executable(router ${SRC_ROUTER} ${SRC_COMMON})
add_executable(enddevice ${SRC_END_DEVICE} ${SRC_COMMON})




















